package archforce.atp.x.ui.impl.right;

import archforce.atp.x.ui.frame.component.AbstractRowItemComponent;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wx
 * @version 1.0
 * @date 2022/4/11 13:44
 */
@Deprecated
public class IPPortMappingGroupComponent extends AbstractRowItemComponent<List<IPPortMappingModel>> {

    private List<IPPortMappingModel> data;
    private List<IPPortMappingItemComponent> components;

    public IPPortMappingGroupComponent() {
        data = new ArrayList<>();
        data.add(new IPPortMappingModel(true));
        init(data);
    }

    public IPPortMappingGroupComponent(List<IPPortMappingModel> data) {
        init(data);
    }

    private void init(List<IPPortMappingModel> data){
        this.data = data;
        components = new ArrayList<>(data.size());
        this.data.forEach(peer ->{
            IPPortMappingItemComponent component = new IPPortMappingItemComponent(peer);
            components.add(component);
            add(component);
        });
    }

    @Override
    public void setBindData(List<IPPortMappingModel> bindData) {
        this.data = bindData;
    }

    @Override
    public List<IPPortMappingModel> getBindData() {
        return data;
    }

}
